String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}

String.prototype.ltrim = function() {
	return this.replace(/^\s+/g,"");
}

String.prototype.rtrim = function() {
	return this.replace(/\s+$/g,"");
}

Array.prototype.contains = function (element)
{
	for (var i = 0; i < this.length; i++)
	{
		if (this[i] == element)
		{
			return true;
		}
	}
	return false;
};

Array.prototype.ccount = function(palabra) {
    var coincidencias = 0;
    for (var i=0; i<this.length; i++) {
        if (this[i] == palabra) {
            coincidencias++;
        }
    }
    return coincidencias;
};

Array.prototype.find = function(palabra, start) {
    var coincidencias = 0;
		start = (start) ? start : 0;
    for (var findi=start; findi<this.length; findi++) {
        if (this[findi] == palabra) {
            return findi;
        }
    }
    return false;
};

Array.prototype.fieldFind = function(field, value, start) {
		start = (start) ? start : 0;
    for (var i=start; i<this.length; i++) {
			if (this[i][field]){
				if (typeof(this[i][field]) == "array"){
					return this[i][field].find(value);
				} else {
					if (this[i][field] == value) {
            return i;
					}
				}
			}
    }
    return false;
};
		
var css;
function include_css(css_file) {
    var html_doc = document.getElementsByTagName('head')[0];
    css = document.createElement('link');
    css.setAttribute('rel', 'stylesheet');
    css.setAttribute('type', 'text/css');
    css.setAttribute('href', css_file);
    html_doc.appendChild(css);

    // alert state change
    css.onreadystatechange = function () {
        if (css.readyState == 'complete') {
            alert('CSS onreadystatechange fired');
        }
    }
    css.onload = function () {
        alert('CSS onload fired');
    }
    return false;
}

var js;
function include_js(file) {
    var html_doc = document.getElementsByTagName('head')[0];
    js = document.createElement('script');
    js.setAttribute('type', 'text/javascript');
    js.setAttribute('src', file);
    html_doc.appendChild(js);

    js.onreadystatechange = function () {
        if (js.readyState == 'complete') {
            alert('JS onreadystate fired');
        }
    }

    js.onload = function () {
        alert('JS onload fired');
    }
    return false;
}

//include_js("../../../js/dltypeof.js");
//include_js("../../../js/xwrtGrid.js");

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

var xwrt = new Object();
xwrt.Ids = new Array();

addLoadEvent(function() {
	var e = document.getElementsByTagName("*");
	for(var x=1; x < e.length; x++){
		if (e[x].getAttribute("xwrtType")){
			var myattr = e[x].getAttribute("xwrtType");
			var id = e[x].getAttribute("id");
//			alert(id);
			var xWrtId = xwrt.Ids.length;
			id = (id) ? id : xWrtId;
			e[x].setAttribute("xWrtId",xWrtId);
			e[x].setAttribute("id",id);
			xwrt.Ids.push(eval(myattr));
//			alert(xWrtId+" - "+id+" length "+xwrt.Ids.length);
			xwrt[id] = new xwrt.Ids[xWrtId](e[x]);
		}
	}
});

function addEvent( obj, type, fn ) {
  if ( obj.attachEvent ) {
    obj['e'+type+fn] = fn;
    obj[type+fn] = function(){obj['e'+type+fn]( window.event );}
    obj.attachEvent( 'on'+type, obj[type+fn] );
  } else
    obj.addEventListener( type, fn, false );
}

function removeEvent( obj, type, fn ) {
  if ( obj.detachEvent ) {
    obj.detachEvent( 'on'+type, obj[type+fn] );
    obj[type+fn] = null;
  } else
    obj.removeEventListener( type, fn, false );
}
var isNumeric = function(x) {
// returns true if x is numeric and false if it is not.
	var RegExp = /^(-)?(\d*)(\.?)(\d*)$/;
	return String(x).match(RegExp);
}

var ajaxObject = function (url, callbackFunction) {
  var that=this;
	this.readyState = 0;
	this.updating = false;
	this.status = 0;
	this.onEventFunctions = Array();
	this.responseText = new String();
	this.statusText = new String();
	this.responseXML = new String();
//	this.statePopUp = new loadingDataPopUp("Uninitialized");
  this.abort = function() {
		if (that.updating) {
			that.updating=false;
      that.AJAX.abort();
      that.AJAX=null;
		}  
	} 
	this.update = function(passData,postMethod) {
		if (that.updating) {
			return false; 
		}
    that.AJAX = null;
		if (window.XMLHttpRequest) {
			that.AJAX=new XMLHttpRequest();
		} else {
			that.AJAX=new ActiveXObject("Microsoft.XMLHTTP");
		}
		if (that.AJAX==null) {
			return false;
		} else {
			that.AJAX.onreadystatechange = function() {
				that.readyState = that.AJAX.readyState;
				if (that.AJAX.readyState==4) {
					that.updating=false;
					that.responseText = that.AJAX.responseText
					that.status = that.AJAX.status;
					that.statusText = that.AJAX.statusText;
					that.responseXML = that.AJAX.responseXML;
					that.callback(that.AJAX.responseText,that.AJAX.status,that.AJAX.responseXML);
					that.AJAX=null;
				}
				that.onStateChanged(that.readyState);
			}
			that.updating = new Date();
			if (/post/i.test(postMethod)) {
				var uri=urlCall+'?'+that.updating.getTime();
        that.AJAX.open("POST", uri, true);
        that.AJAX.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        that.AJAX.setRequestHeader("Content-Length", passData.length);
        that.AJAX.send(passData);
			} else {
				var uri=urlCall+'?'+passData+'&timestamp='+(that.updating.getTime());
				that.AJAX.open("GET", uri, true);
				that.AJAX.send(null);
			}
			return true;
		}
	}  
	var urlCall = url;
	this.onStateChanged = function (state) {
		for (obj=0;obj<this.onEventFunctions.length;obj++){
			if(state == 1){
				this.onEventFunctions[obj].loadingData();
			} else if (state == 2){
				this.onEventFunctions[obj].loadedData();
			} else if (state == 3){
				this.onEventFunctions[obj].interactiveData();
			} else if (state == 4){
				this.onEventFunctions[obj].completeData();
			}
		}
	};
	this.callback = callbackFunction || function () {};
}

/*
function processData(responseText, responseStatus) {
  if (responseStatus==200) {
		this.rows = responseText.split('\n');
	} else {
		this.rows.push(responseStatus + ' -- Error Processing Request');
	}
}
*/

var loadingDataPopUp = function (msg){
	var mymsg = (msg) ? msg : "Loading Data";
	var waitdiv = document.createElement("div");
	waitdiv.style.position="absolute";
	waitdiv.style.minWidth="126px";
	waitdiv.style.minHeight="22px";
	waitdiv.style.backgroundImage="url('../../../images/loading.gif')";
	waitdiv.style.backgroundRepeat="no-repeat";
	waitdiv.style.top="0";
	waitdiv.style.left="0";
	waitdiv.style.border="1px solid green";
	waitdiv.style.color="red";
	waitdiv.style.fontSize="11px";
	waitdiv.style.textAlign="center";
	waitdiv.innerHTML="<p style='margin:4px 0'>"+mymsg+"</p>";
	waitdiv.style.display = "none";
	return waitdiv;
}

var newData = function(el){
	var url = el.getAttribute("url");
	var callbackFn = el.getAttribute("callbackFn");
	var srcData = el.getAttribute("srcData");
	var storeId = el.getAttribute("storeId");
	if (callbackFn) callbackFn = eval(callbackFn);
	if (url) {
		xwrt[storeId] = new ajaxObject(url, callbackFn);
	} else {
		xwrt[storeId] = new Object();
		xwrt[storeId].rows = new Array();
		if (callbackFn){
			xwrt[storeId].rows = callbackFn();
		} else {
			if (srcData) {
				xwrt[storeId].rows = eval(srcData);
			}
		}
	}
	xwrt[storeId].name = storeId;
}

var Grid = function (el){
	this.data = new Array();
	var xWrtId = el.getAttribute("xWrtId");
	var storeId = el.getAttribute("storeId");
	if (typeof(xwrt[storeId].rows) == "undefined"){
		xwrt[storeId].rows = new Array();
	}
	this.loadingData = function () {
		waitdiv.style.display = "block";
	}
	this.loadedData = function () {
	}
	this.interactiveData = function () {
	}
	this.completeData = function () {
		if (filterFn){
			var myfunc = eval(filterFn);
			this.data = myfunc(xwrt[storeId].rows);
		} else {
			this.data = xwrt[storeId].rows;
		}
		for (var i=0; i<this.data.length;i++){
			this.showData(i);
		}
		waitdiv.style.display="none";
	}
	// Rows events
	var onRowClick = el.getAttribute("onRowClick") ? eval(el.getAttribute("onRowClick")) : null;
	var onRowOver =  el.getAttribute("onRowOver") ? eval(el.getAttribute("onRowOver")) : null;
	var onRowOut = el.getAttribute("onRowOut") ? eval(el.getAttribute("onRowOut")) : null;
	// Cell events
	var onCellClick = el.getAttribute("onCellClick") ? eval(el.getAttribute("onCellClick")) : null;
	var onCellOver = el.getAttribute("onCellOver") ? eval(el.getAttribute("onCellOver")) : null;
	var onCellOut = el.getAttribute("onCellOut") ? eval(el.getAttribute("onCellOut")) : null;

	var myId = el.getAttribute("id");
	var TH_el = el.getElementsByTagName("TH");

	var titheight = TH_el[0].offsetHeight;

	var myparent = el.parentNode;
	var divheight = myparent.clientHeight;
	var filterFn = el.getAttribute("filterFn");

	var maindiv = document.createElement("div");
	maindiv.id = myId;
	var titlediv = document.createElement("div");

	titlediv.style.width=myparent.clientWidth;
	titlediv.style.height=titheight;

	var titles = new Array();
	var fields = new Array();
	var widths = new Array();
	var aligns = new Array();
	for(var i=0;i<TH_el.length;i++){
		var tel = TH_el[i];
		var width = tel.getAttribute("width");
		var align = tel.getAttribute("align") || "left";
		var name = tel.getAttribute("field");
		var text = (tel.innerHTML =="") ? tel.getAttribute("field") : tel.innerHTML;
		var mydiv = document.createElement("div");
		mydiv.innerHTML = text;
		widths.push(width);
		aligns.push(align);
		fields.push(name);
		mydiv.style.height=titheight;
		if (width) mydiv.style.width = width;
		mydiv.style.cssFloat='left';
		mydiv.style.styleFloat='left';
		mydiv.style.clear = "none";
		mydiv.style.overflow="hidden";
		mydiv.id=myId+":title:"+name;
		mydiv.gridId=myId;
		mydiv.storeId = storeId;
		titlediv.appendChild(mydiv);
	}
	var waitdiv = loadingDataPopUp(el.getAttribute("id"));
	var datadiv = document.createElement("div");
	datadiv.style.height=(divheight-titheight)+"px";
	datadiv.style.overflow="auto";
	datadiv.style.position="relative";
	datadiv.style.clear="both";
//	datadiv.style.overflowY = 'scroll';
//	datadiv.style.setAttribute("cursor","hand",0); 
	var mytabla = document.createElement("table");
	mytabla.width="99.99%";
	mytabla.id=myId+"_table";
	
	var color = "#aabbcc";
	this.insertData = function (data){
		var i = this.data.length;
		if (typeof(data.xwrtStatus)=="undefined"){
			data.xwrtStatus = new Array();
		}
		data.xwrtStatus.push("new");
		this.data.push(data);
		this.showData(i);
		return i;
	}
	this.reShowData = function () {
		for (var i=0;i<this.data.length;i++){
			for (var n=0;n<fields.length;n++){
				document.getElementById(myId+"_row:"+i+":"+fields[n]).innerHTML=this.data[i][fields[n]];
			}
		}
	}
	this.resetTable = function () {
		var mytabla = document.getElementById(myId+"_table");
		while (mytabla.rows.length>0){ //deletes all rows of a table
			mytabla.deleteRow(0);
		}
		for (var i=0; i<this.data.length;i++){
			this.showData(i);
		}
	}
	this.showData = function (i) {
		var newrow = mytabla.insertRow(i);
		newrow.className = "packages";
		newrow.gridId=myId;
		newrow.id=myId+"_row:"+i;
		newrow.storeId = storeId;
		newrow.data=this.data[i];
		newrow.gridData=this.data;
		addEvent(newrow, "mouseover", function() { this.style.backgroundColor="#ffcccc";} );
		if (onRowOver) {addEvent(newrow, "mouseover", onRowOver );}
		if (onRowOut) {addEvent(newrow, "mouseout", onRowOut );}
		if (onRowClick) { addEvent(newrow, "click", onRowClick ); newrow.style.cursor="hand"; }
		if (color == "#ccddee"){
			addEvent(newrow, "mouseout",  function() { this.style.backgroundColor="#aabbcc";} );
			color = "#aabbcc";
		} else {
			addEvent(newrow, "mouseout",  function() { this.style.backgroundColor="#ccddee";} );
			color = "#ccddee";
		}
		newrow.style.backgroundColor=color;
		for (var n=0;n<fields.length;n++){
			var myCell = newrow.insertCell(n);
			myCell.storeId = storeId;
			myCell.gridId=myId;
			myCell.rowId=newrow.id;
			myCell.id=newrow.id+":"+fields[n];
			var celldiv = document.createElement("div");
			celldiv.style.width = widths[n];
			celldiv.style.textAlign = aligns[n];
			celldiv.innerHTML=this.data[i][fields[n]];
			myCell.appendChild(celldiv);
		}

		for (var n=0;n<fields.length;n++){
			if (mytabla.rows.length > 0){
				if (titlediv.childNodes[n].clientWidth < mytabla.rows[0].cells[n].clientWidth){
					titlediv.childNodes[n].style.width = mytabla.rows[0].cells[n].clientWidth;
				}else{
					mytabla.rows[0].cells[n].style.width = titlediv.childNodes[n].clientWidth;
				}
			}
		}

	}
	waitdiv.style.display="block";
	if (xwrt[storeId].onEventFunctions){
		xwrt[storeId].onEventFunctions.push(this);
		if (xwrt[storeId].readyState == 0){
			xwrt[storeId].update();
		}
	} else {
		this.completeData();
		waitdiv.style.display="none";
	}
//	el.style.display="block";
	datadiv.appendChild(waitdiv);
	datadiv.appendChild(mytabla);
	maindiv.appendChild(titlediv);
	maindiv.appendChild(datadiv);
	myparent.replaceChild(maindiv,el);
}

var repofile = function (responseText, responseStatus, responseXML){
	if (responseStatus != 200) return responseStatus;
	var lines = new Array();
	lines = responseText.split('\n');
	if (lines.length == 0) return;
	var myNames = new Array();

	var pkgObj=null;
	var repoName;
	var pkgName;
	var pkgVersion;
	var key=null;
	var val;
	var cx = lines.length;
	for (x=0; x<cx;x++){
		lines[x] = lines[x].trim();
		if (lines[x].length == 0) continue;
		var reg = [];
		reg = lines[x].split(":");
		if (reg.length == 1 && typeof(pkgObj) != "undefined" && pkgObj != null && key != null){
//			alert(repoName+"\n"+pkgName+"\n"+key+"\n"+pkgObj[key]+"\n"+reg[0]);
			pkgObj[key] = pkgObj[key] + reg[0];
			continue;
		} else {
			key = reg[0].trim();
			val = reg[1].trim();
		}
		if (key == "Repository"){
			repoName = val;
			continue;
//		} else if (key == "URL"){
//			pkgURL = val+":"+reg[2]+"/Packages/";
//			continue;
		} else if (key == "Package"){
			pkgName = val;
			continue;
		} else if (key == "Version"){
			if (pkgObj) {
				this.rows.push(pkgObj);
				myNames.push(pkgObj.Package+pkgObj.Version);
				pkgObj = null;
			}
			var regn = myNames.find(pkgName+val);
			if ( regn !== false){
				if (this.rows[regn].Repository.find(repoName) == false){
					this.rows[regn].Repository.push(repoName);
				}
				continue;
			}
			pkgVersion = val;
			pkgObj = new Object();
			pkgObj.Package = pkgName;
			pkgObj.Repository = new Array(repoName);
		}
		if (pkgObj) pkgObj[key] = val;
	}
	
	if (pkgObj){
		this.rows.push(pkgObj);
		myNames.push(pkgObj.Package+pkgObj.Version);
	}
}

function busca(myObj, myField, myOp, myValue){
	sTypeOf = dltypeof(myObj);
	alert(sTypeOf);
}

function VscrollDetect(elem) {
	if (elem.scrollHeight > elem.clientHeight) {
		return true;
	} else {
		return false;
	}
}
function HscrollDetect(elem) {
	if (elem.scrollWidth > elem.clientWidth) {
		return true;
	} else {
		return false;
	}
}

function used_width(mel){
	if (mel.style.display == "none") return 0;
	var bl = parseFloat((mel.style.borderLeftWidth) ? mel.style.borderLeftWidth : 0);
	var br = parseFloat((mel.style.borderRightWidth) ? mel.style.borderRightWidth : 0);
	return mel.offsetWidth;// + ( bl + br);
}

function free_width(mel){
//	if (mel.style.display == "none") return 0;//mel.parentNode.clientWidth;
	if (mel.style.display == "none") mel.parentNode.clientWidth;
	var bl = parseFloat((mel.style.borderLeftWidth) ? parseFloat(mel.style.borderLeftWidth) : 0);
	var br = parseFloat((mel.style.borderRightWidth) ? parseFloat(mel.style.borderRightWidth) : 0);
	if(mel.parentNode){
/*
		if (mel.parentNode.tagName=="BODY"){
			alert(mel.parentNode.offsetWidth - ( bl + br ));
		}
*/
		return mel.parentNode.clientWidth - ( bl + br );
//	} else {
//		return "auto";
	}
}

function used_height(mel){
	if (mel.style.display == "none") return 0;
	var bt = parseFloat((mel.style.borderTopWidth) ? mel.style.borderTopWidth : 0);
	var bb = parseFloat((mel.style.borderBottomWidth) ? mel.style.borderBottomWidth : 0);
//	return mel.clientHeight + ( bt + bb);
	return mel.offsetHeight;
}

function free_height(mel){
	if (mel.style.display == "none") mel.parentNode.clientHeight;//return 0;
	var bt = parseFloat((mel.style.borderTopWidth) ? parseFloat(mel.style.borderTopWidth) : 0);
	var bb = parseFloat((mel.style.borderBottomWidth) ? parseFloat(mel.style.borderBottomWidth) : 0);
	if (mel.parentNode){
		return parseFloat(mel.parentNode.clientHeight) - (bt + bb);
//	} else {
//		return "auto";
	}
}

var container = function(el){
	this.el = el;
	var that = this;
	this.el.style.position="relative";

	if (this.el.getAttribute("width")){
		this.el.style.width = this.el.getAttribute("width");
	}
	if (this.el.getAttribute("height")){
		this.el.style.height = this.el.getAttribute("height");
	}

// top frame
	this.el_top = document.createElement("div");
	this.el_top.style.position="relative";
	this.el_top.style.left="0px";
	this.el_top.style.top="0px";
	this.el_top.height="0px";
	this.el_top.style.display="none";
// bottom frame
	this.el_bottom = document.createElement("div");
	this.el_bottom.style.position="absolute";
	this.el_bottom.style.left="0px";
	this.el_bottom.style.bottom="0px";
	this.el_bottom.style.width="100%";
	this.el_bottom.style.display="none";
// medium frame is to contain left, right and center region
	this.el_medium = document.createElement("div");
	this.el_medium.style.position="relative";
	this.el_medium.style.height="100%";
// left frame
	this.el_left = document.createElement("div");
	this.el_left.style.styleFloat="left";
	this.el_left.style.cssFloat="left";
	this.el_left.style.position="relative";
	this.el_left.style.height="100%";
// center frame
	this.el_center = document.createElement("div");
	this.el_center.style.position="relative";
	this.el_center.style.styleFloat="left";
	this.el_center.style.cssFloat="left";
	this.el_center.style.width = "100%";
	this.el_center.style.overflow="auto";
// right frame
	this.el_right = document.createElement("div");
	this.el_right.style.styleFloat="right";
	this.el_right.style.cssFloat="right";
	this.el_right.style.position="relative";
	this.el_right.style.height="100%";
	this.el_right.style.overflow="auto";

	this.resize = function () {
		this.el_top.style.width=free_width(this.el_top)+"px";
		this.el_bottom.style.width=free_width(this.el_bottom)+"px";
		this.el_medium.style.width=free_width(this.el_medium)+"px";
		this.el_medium.style.height=free_height(this.el_medium) - (used_height(this.el_top) + used_height(this.el_bottom))+"px";
		this.el_center.style.width=(free_width(this.el_center) - (used_width(this.el_left)+used_width(this.el_right)))+"px";
		this.el_center.style.height=free_height(this.el_center)+"px";
		this.el_left.style.height=free_height(this.el_left)+"px";
		this.el_right.style.height=free_height(this.el_right)+"px";
	}
	
	var elements = this.el.getElementsByTagName("*");
	for(var i=0;i<elements.length;i++){
		var str_region = elements[i].getAttribute("region");
		var str_type = elements[i].getAttribute("xwrtType");
		if( str_region ){
			switch (str_region) {
				case "top" :
					this.el_top = elements[i].cloneNode(true);
					if (elements[i].getAttribute("height")){
						this.el_top.style.height = elements[i].getAttribute("height");
					}
					this.el_top.style.position="relative";
					this.el_top.style.left="0px";
					this.el_top.style.top="0px";
					this.el_top.style.overflow="auto";
					this.el_top.style.display="block";
					elements[i].parentNode.removeChild(elements[i]);
					i--;
				break;
				case "bottom" :
					this.el_bottom = elements[i].cloneNode(true);
					if (elements[i].getAttribute("height")){
						this.el_bottom.style.height = elements[i].getAttribute("height");
					}
					this.el_bottom.style.position="absolute";
					this.el_bottom.style.left="0px";
					this.el_bottom.style.bottom="0px";
					this.el_bottom.style.overflow="auto";
					this.el_bottom.style.display="block";
					elements[i].parentNode.removeChild(elements[i]);
					i--;
				break;
				case "left" :
					this.el_left = elements[i].cloneNode(true);
					if (elements[i].getAttribute("width")){
						this.el_left.style.width = elements[i].style.width || elements[i].getAttribute("width") || "20%";
					}
					this.el_left.style.styleFloat="left";
					this.el_left.style.cssFloat="left";
					this.el_left.style.position="relative";
					this.el_left.style.height="100%";
					this.el_left.style.overflow="auto";
					elements[i].parentNode.removeChild(elements[i]);
					i--;
				break;
				case "right" :
					this.el_right = elements[i].cloneNode(true);
					if (elements[i].getAttribute("width")){
						this.el_right.style.width = elements[i].getAttribute("width");
					}
					this.el_right.style.styleFloat="right";
					this.el_right.style.cssFloat="right";
					this.el_right.style.position="relative";
					this.el_right.style.height="100%";
					this.el_right.style.overflow="auto";
					elements[i].parentNode.removeChild(elements[i]);
					i--;
				break;
				case "center" :
					this.el_center = elements[i].cloneNode(true);
					this.el_center.style.position="relative";
					this.el_center.style.styleFloat="left";
					this.el_center.style.cssFloat="left";
					this.el_center.style.overflow="auto";
					elements[i].parentNode.removeChild(elements[i]);
					i--;
				break;
			}
		}
	}
	
	this.el.appendChild(this.el_top);
	this.el.appendChild(this.el_bottom);
	this.el.appendChild(this.el_medium);
	this.el_medium.appendChild(this.el_left);
	this.el_medium.appendChild(this.el_center);
	this.el_medium.appendChild(this.el_right);
	
	this.resize();
	this.resize();
	addEvent(window, "resize", function() { that.resize() } );

}

var modalDialog = function (message,height,width){
	var backDiv = document.createElement("div");
	var frontDiv = Diadog(message,height,width);
	backDiv.style.width=window.innerWidth;
	backDiv.style.height=window.offsetHeight;
	backDiv.style.backgroundColor="#444444";
	backDiv.style.transparent="50%";
	backDiv.appendChild(frontDiv);
	return backDiv;
}

var Dialog = function (message,height,width){
	var frontDiv = document.createElement("div");
	frontDiv.style.position="absolute";
	frontDiv.innerHTML=message;
	var calcwidth = (width) ? width : frontDiv.offsetWidth;
	var calcheight = (height) ? height : frontDiv.offsetHeight;
	frontDiv.style.width = calcwidth;
	frontDiv.style.height = calcheight;
	
//  var x = (window.innerWidth / 2) - (calcwidth / 2);
//  var y = (window.offsetHeight / 2) - (calcheight / 2);
//	alert("x = "+x+" y = "+y);
	frontDiv.style.top=100;
	frontDiv.style.left=100;
	return frontDiv;
}
/*
var TabContainer = function (el) {
	this.tabs = new Array();
	this.index = 0;
	el.style.width="50%";
	el.style.height="100%";
	el.style.backgroundColor="#FFFFFF";
	this.addTab = function (tabId) {alert(tabId)};
}

var Tab = function (el) {
	el.style.display="none";
	var tabContainer = xwrt["TabContiner"+el.parentNode.id];
	tabContainer.addTab(el.id);
	//tabContainer.replaceChild(this,el);
}

*/
var contentPanel = function (el) {
}

